<!-- 个人信息 -->
<template>
	<view class="container">

		 
		
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd">
				<view class="uni-list-cell-db">系统版本号</view>
				<view class="uni-list-cell-db">{{version}} </view>
			</view>
		</view>
		
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd" @tap="navigateTodetail1()">
				<view class="uni-list-cell-db">关于我们</view>
				<text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;"></text>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd"  @tap="navigateTodetail1()">
				<view class="uni-list-cell-db">注册协议</view>
				 <text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;"></text>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd" @tap="navigateTodetail2()">
				<view class="uni-list-cell-db">隐私协议</view>
				<text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;"></text>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd" @tap="jump('/pages/user/clearuser')">
				<view class="uni-list-cell-db">账号与安全</view>
				<text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;"></text>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd">
				<view class="uni-list-cell-db">定向推送</view>
				<switch :checked="opents==1?'checked':''"  @change="tschange"/>
			</view>
		</view>
		<view class="uni-list">
			<view class="uni-list-cell uni-list-cell-pd" @tap="showModal = true">
				<view class="uni-list-cell-db">退出登录</view> 
				<text class="u-iconfont uicon-arrow-right" style="color: #bfbfbf;"></text>
			</view>
		</view>
		<u-modal ref="uModal" v-model="showModal" :show-cancel-button="true" confirm-color="#F54141"
			cancel-color="#666666" @confirm="confirmLogOut" content="确定退出登录？"></u-modal>
		<u-modal ref="uModal" v-model="deleteuser" :show-cancel-button="true" confirm-color="#F54141"
			cancel-color="#666666" @confirm="confirmdelete" content="确定要注销账号？"></u-modal>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from 'vuex';
	import Auth from '@/ljshop/permission/index.js';
	import wechat from '@/ljshop/wechat/wechat';

	export default {
		components: {},
		data() {
			return {
				version: 0,
				platform: this.$platform.get(),
				userData: {},
				showCalendar: false,
				showModal: false,
				editInfoDisabled: false,
				thirdOauthInfo: null, //第三方信息
				avatar: '',
				changeAvater: false,
				changename: false,
				name: "",
				userInfo: {},
				deleteuser: false,
				opents:uni.getStorageSync("opents")==1?1:0

			};
		},
		computed: {

		},
		onLoad() {
			this.getInfo();

		},
		methods: {
			jump(path, query) {
				this.$Router.push({
					path: path,
					query: query
				});
			},

			getInfo() {
				this.version = plus.runtime.version;


			},
			// 退出登录
			confirmLogOut() {
				uni.removeStorageSync("UId");
				uni.removeStorageSync("token");
				uni.removeStorageSync("isLogin");
				this.$Router.back();
			},
			confirmdelete() {
				let that = this
				//console.info(uni.getStorageSync("userinfo").mobile )
				that.$http(
					'user.clearuser', {
						mobile: uni.getStorageSync("userinfo").mobile
					},
					'保存中...'
				).then(res => {

					uni.removeStorageSync("UId");
					uni.removeStorageSync("token");
					uni.removeStorageSync("isLogin");
					this.$Router.back();

				});

			},
			navigateTodetail1() {
			 
				
				this.$Router.push({
					path: '/pages/public/webview',
					query: {
						webviewPath:  "https://www.hzwltb69.com/article/detail/14_0"
					}
				})
			},
			navigateTodetail2() {
				this.$Router.push({
					path: '/pages/public/webview',
					query: {
						webviewPath:  "https://www.hzwltb69.com/article/detail/40_0"
					}
				})
			},


			// 修改昵称
			onChangeusername() {

			},
			// 修改手机号
			bindMobile() {

			},
			tschange(e){
				console.info(JSON.stringify(e))
				if(e.detail.value){
					uni.setStorageSync("opents",1)
				}else{
					uni.setStorageSync("opents",0)
				}
			}

		}
	};
</script>

<style lang="scss" scoped>
	.uicon-arrow-right:before {
	    content: "\e605";
	}
	// 基本信息
	.info-head {
		.info-title {
			line-height: 60rpx;
			font-size: 28rpx;
			font-weight: 600;
			color: #333333;
		}

		.save-btn {
			color: #fff;
			background: linear-gradient(90deg, rgba(233, 180, 97, 1), rgba(238, 204, 137, 1));
			width: 100rpx;
			border-radius: 30rpx;
			height: 60rpx;
			line-height: 60rpx;
			font-size: 28rpx;
		}

		.dis-btn {
			opacity: 0.5;
		}
	}

	// 三方
	.other-account {
		.head-title {
			line-height: 82rpx;
			font-size: 28rpx;
			font-weight: 600;
			color: #333333;
		}

		.list-img {
			width: 40rpx;
			height: 40rpx;
			margin-right: 10rpx;
		}

		.account-list {
			background-color: #fff;
			height: 100rpx;
			padding: 0 20rpx;

			.info {
				.avatar {
					width: 38rpx;
					height: 38rpx;
					border-radius: 50%;
					overflow: hidden;
				}

				.name {
					font-size: 28rpx;
					font-weight: 400;
					color: #999999;
				}
			}

			.bind-box {
				.bind-btn {
					padding: 0 20rpx;
					line-height: 60rpx;
					background: #f5f6f8;
					border-radius: 20rpx;
					color: #999;
				}

				.relieve-btn {
					border-radius: 20rpx;
					padding: 0 20rpx;
					line-height: 60rpx;
					background: rgba(#ff0000, 0.05);
					color: #ff0000;
				}
			}
		}
	}

	// 个人信息项
	.user-list {
		background: #fff;
		height: 100rpx;
		border-bottom: 1rpx solid #f6f6f6;
		padding: 0 40rpx;

		.list-name {
			font-size: 28rpx;

		}

		.avatar {
			width: 67rpx;
			height: 67rpx;
			border-radius: 50%;
		}

		.list-val {
			color: #999;
			font-size: 28rpx;
			text-align: right;
		}
	}

	.btn-box {
		margin-top: 200rpx;

		.logout-btn {
			width: 710rpx;
			height: 80rpx;
			line-height: 80rpx;
			border: 1rpx solid #f54141;
			border-radius: 40rpx;
			font-size: 30rpx;
			font-weight: 500;
			color: #f54141;
		}

		.hover-logout-btn {
			width: 710rpx;
			height: 80rpx;
			background: #f54141;
			border: 1rpx solid #f54141;
			border-radius: 40rpx;
			font-size: 30rpx;
			font-weight: 500;
			color: #ffffff;
		}
	}

	.uni-list {
		background-color: #FFFFFF;
		position: relative;
		width: 96%;
		margin-left: 2%;
		display: flex;
		flex-direction: column;
		margin-top: 10rpx;
		border-bottom: #f1f1f1 1rpx solid;
	}

	.uni-list-cell {
		position: relative;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.uni-list-cell-pd {
		padding: 12px 16px;
	}

	.uni-switch .uni-switch-wrapper {
		display: -webkit-inline-flex;
		display: -webkit-inline-box;
		display: inline-flex;
		-webkit-align-items: center;
		-webkit-box-align: center;
		align-items: center;
		vertical-align: middle;
	}

	.uni-switch .uni-switch-input {
		-webkit-appearance: none;
		appearance: none;
		 
		width: 52px;
		height: 32px;
		margin-right: 5px;
		border: 1px solid #dfdfdf;
		outline: 0;
		border-radius: 16px;
		box-sizing: border-box;
		background-color: #dfdfdf;
		-webkit-transition: background-color .1s, border .1s;
		transition: background-color .1s, border .1s;
	}
	 
</style>